<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .father{
            width: 300px;
            height: 300px;
            background-color:#bafa;     
            margin: 100px auto;
            padding-top: 100px;
            padding-left: 100px;
        }
        .son{
            width: 200px;
            height: 200px;
            /* margin: 100px auto; */
            background-color: #fff;
        }
    </style>
</head>
<body>
    <div class="father">
        father
        <div class="son">son</div>
    </div>

    <script>
        //给son绑定事件
        var son = document.querySelector('.son');
        son.addEventListener('click',function(e){
            alert('son');
            if(e && e.stopPropagation){
                e.stopPropagation();
            }else{
                window.event.cancelBubble = true;
            }
        },false);
        //给father绑定事件
        var father = document.querySelector('.father');
        father.addEventListener('click',function(){
            alert('father');
        },false);
    </script>
</body>
</html>